<!--
 * @Author: your name
 * @Date: 2020-07-13 18:46:27
 * @LastEditTime: 2020-07-14 09:16:25
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vue_plugins\src\views\form\index.vue
--> 
<template>
  <div class="container">
    <van-nav-bar title="表单生成器" :border="false" fixed left-arrow @click-left="$router.go('-1')" />
    <form-create ref="fc" v-model="fApi" :rule="rule" :option="option"></form-create>
  </div>
</template>

<script>
import { maker } from "@form-create/element-ui";
export default {
    components: {
        maker
    },
    data() {
        return {
            fApi: {},
            model: {},
            rule: [
                maker.input("商品名称", "goods_name"),
                maker.date("上传时间", "created_at"),
                maker.input("数量", "number")
            ],
            option: {
                onSubmit: function(formData) {
                    alert(JSON.stringify(formData));
                }
            }
        };
    },
    mounted() {
        this.model = this.fApi.model();
    }
};
</script>

<style lang="less" scoped>
</style>